package com.lsh.oms.api.model.order.receipt;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author peter
 */
@Setter
@Getter
@NoArgsConstructor
public class ReceiptDetailDto implements Serializable, Comparable<ReceiptDetailDto> {

    private static final long serialVersionUID = -1379186968889631415L;

    private Long skuId;

    private Long itemCode;

    private BigDecimal qty;

    @Override
    public int compareTo(ReceiptDetailDto receiptDetailDto) {
        if (receiptDetailDto == null) {
            return 1;
        }
        if (!this.skuId.equals(receiptDetailDto.skuId)) {
            return this.skuId.compareTo(receiptDetailDto.getSkuId());
        }
        return this.qty.compareTo(receiptDetailDto.getQty());
    }
}